<?php

$DocObjct = $_POST['OBJCTCL'];
$ORIAUTHZ = $GLOBALS['MYT']->db_array("SELECT OriClave FROM Origenes WHERE OriNumero = {$_SESSION[$SESSCD]}");

if (!isset($_POST['qrType']) || $_POST['qrType'] == 1) {
    $FiltDate = '';
} elseif ($_POST['qrType'] == 2) {
    if ($_POST['qrOther'] == 1) {
        $FiltDate = " AND FraFechaIngreso > DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH)";
    } elseif ($_POST['qrOther'] == 2) {
        $FiltDate = " AND FraFechaIngreso > DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)";
    } elseif ($_POST['qrOther'] == 3) {
        $FiltDate = " AND FraFechaIngreso > DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR)";
    }
} elseif ($_POST['qrType'] == 3) {
    $FiltDate = " AND FraFechaIngreso BETWEEN '{$_POST['qrTimeStart']}' AND '{$_POST['qrTimeEnd']}' ";
}

if ($_POST['OriKey'] == $ORIAUTHZ[1]['OriClave']) {
    mn_field('button', 'ED', 'MkPrint', 'Imprimir', '', '', '', '"
		onclick="newprint(\'' . $GLOBALS['URL'] . 'Aplications/Export_Print.mex?OB=' . $DocObjct . '&MOD=' . $MOD . '&ID=' . $_POST['QrType'] . '\',\'Printer\');');
    include($GLOBALS['BIB'] . "FileTemplates\HTML\\" . $MOD . "_" . $_POST['QrType'] . ".mex");
    echo $html_Obj;
} else {
    echo '<div class="Error">Consulta Negada.</div>';
}